/**
 */
package com.logicfishsoftware.plugbench.wPPlugBench.impl;

import com.logicfishsoftware.plugbench.wPPlugBench.ChoiceFn;
import com.logicfishsoftware.plugbench.wPPlugBench.ChoiceParam;
import com.logicfishsoftware.plugbench.wPPlugBench.CustomParam;
import com.logicfishsoftware.plugbench.wPPlugBench.CustomParamFn;
import com.logicfishsoftware.plugbench.wPPlugBench.DefaultOptionParam;
import com.logicfishsoftware.plugbench.wPPlugBench.SelectParam;
import com.logicfishsoftware.plugbench.wPPlugBench.WPPlugBenchPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Default Option Param</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.DefaultOptionParamImpl#getSelect <em>Select</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.DefaultOptionParamImpl#getChoice <em>Choice</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.DefaultOptionParamImpl#getClassName <em>Class Name</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.DefaultOptionParamImpl#getCustomSettings <em>Custom Settings</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.DefaultOptionParamImpl#isSite <em>Site</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.DefaultOptionParamImpl#getDefaultValue <em>Default Value</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.DefaultOptionParamImpl#getTitle <em>Title</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.DefaultOptionParamImpl#getDescription <em>Description</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DefaultOptionParamImpl extends StringParamImpl implements DefaultOptionParam
{
  /**
   * The cached value of the '{@link #getSelect() <em>Select</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSelect()
   * @generated
   * @ordered
   */
  protected ChoiceFn select;

  /**
   * The cached value of the '{@link #getChoice() <em>Choice</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getChoice()
   * @generated
   * @ordered
   */
  protected ChoiceFn choice;

  /**
   * The default value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getClassName()
   * @generated
   * @ordered
   */
  protected static final String CLASS_NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getClassName()
   * @generated
   * @ordered
   */
  protected String className = CLASS_NAME_EDEFAULT;

  /**
   * The cached value of the '{@link #getCustomSettings() <em>Custom Settings</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCustomSettings()
   * @generated
   * @ordered
   */
  protected EList<CustomParamFn> customSettings;

  /**
   * The default value of the '{@link #isSite() <em>Site</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isSite()
   * @generated
   * @ordered
   */
  protected static final boolean SITE_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isSite() <em>Site</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isSite()
   * @generated
   * @ordered
   */
  protected boolean site = SITE_EDEFAULT;

  /**
   * The default value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDefaultValue()
   * @generated
   * @ordered
   */
  protected static final String DEFAULT_VALUE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDefaultValue()
   * @generated
   * @ordered
   */
  protected String defaultValue = DEFAULT_VALUE_EDEFAULT;

  /**
   * The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTitle()
   * @generated
   * @ordered
   */
  protected static final String TITLE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTitle()
   * @generated
   * @ordered
   */
  protected String title = TITLE_EDEFAULT;

  /**
   * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDescription()
   * @generated
   * @ordered
   */
  protected static final String DESCRIPTION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDescription()
   * @generated
   * @ordered
   */
  protected String description = DESCRIPTION_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected DefaultOptionParamImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return WPPlugBenchPackage.Literals.DEFAULT_OPTION_PARAM;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ChoiceFn getSelect()
  {
    return select;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetSelect(ChoiceFn newSelect, NotificationChain msgs)
  {
    ChoiceFn oldSelect = select;
    select = newSelect;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT, oldSelect, newSelect);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSelect(ChoiceFn newSelect)
  {
    if (newSelect != select)
    {
      NotificationChain msgs = null;
      if (select != null)
        msgs = ((InternalEObject)select).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT, null, msgs);
      if (newSelect != null)
        msgs = ((InternalEObject)newSelect).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT, null, msgs);
      msgs = basicSetSelect(newSelect, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT, newSelect, newSelect));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ChoiceFn getChoice()
  {
    return choice;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetChoice(ChoiceFn newChoice, NotificationChain msgs)
  {
    ChoiceFn oldChoice = choice;
    choice = newChoice;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE, oldChoice, newChoice);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setChoice(ChoiceFn newChoice)
  {
    if (newChoice != choice)
    {
      NotificationChain msgs = null;
      if (choice != null)
        msgs = ((InternalEObject)choice).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE, null, msgs);
      if (newChoice != null)
        msgs = ((InternalEObject)newChoice).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE, null, msgs);
      msgs = basicSetChoice(newChoice, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE, newChoice, newChoice));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getClassName()
  {
    return className;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setClassName(String newClassName)
  {
    String oldClassName = className;
    className = newClassName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CLASS_NAME, oldClassName, className));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<CustomParamFn> getCustomSettings()
  {
    if (customSettings == null)
    {
      customSettings = new EObjectContainmentEList<CustomParamFn>(CustomParamFn.class, this, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CUSTOM_SETTINGS);
    }
    return customSettings;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isSite()
  {
    return site;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSite(boolean newSite)
  {
    boolean oldSite = site;
    site = newSite;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SITE, oldSite, site));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDefaultValue()
  {
    return defaultValue;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDefaultValue(String newDefaultValue)
  {
    String oldDefaultValue = defaultValue;
    defaultValue = newDefaultValue;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DEFAULT_VALUE, oldDefaultValue, defaultValue));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getTitle()
  {
    return title;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTitle(String newTitle)
  {
    String oldTitle = title;
    title = newTitle;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__TITLE, oldTitle, title));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDescription()
  {
    return description;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDescription(String newDescription)
  {
    String oldDescription = description;
    description = newDescription;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DESCRIPTION, oldDescription, description));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT:
        return basicSetSelect(null, msgs);
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE:
        return basicSetChoice(null, msgs);
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CUSTOM_SETTINGS:
        return ((InternalEList<?>)getCustomSettings()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT:
        return getSelect();
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE:
        return getChoice();
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CLASS_NAME:
        return getClassName();
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CUSTOM_SETTINGS:
        return getCustomSettings();
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SITE:
        return isSite();
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DEFAULT_VALUE:
        return getDefaultValue();
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__TITLE:
        return getTitle();
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DESCRIPTION:
        return getDescription();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT:
        setSelect((ChoiceFn)newValue);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE:
        setChoice((ChoiceFn)newValue);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CLASS_NAME:
        setClassName((String)newValue);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CUSTOM_SETTINGS:
        getCustomSettings().clear();
        getCustomSettings().addAll((Collection<? extends CustomParamFn>)newValue);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SITE:
        setSite((Boolean)newValue);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DEFAULT_VALUE:
        setDefaultValue((String)newValue);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__TITLE:
        setTitle((String)newValue);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DESCRIPTION:
        setDescription((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT:
        setSelect((ChoiceFn)null);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE:
        setChoice((ChoiceFn)null);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CLASS_NAME:
        setClassName(CLASS_NAME_EDEFAULT);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CUSTOM_SETTINGS:
        getCustomSettings().clear();
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SITE:
        setSite(SITE_EDEFAULT);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DEFAULT_VALUE:
        setDefaultValue(DEFAULT_VALUE_EDEFAULT);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__TITLE:
        setTitle(TITLE_EDEFAULT);
        return;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DESCRIPTION:
        setDescription(DESCRIPTION_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT:
        return select != null;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE:
        return choice != null;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CLASS_NAME:
        return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className);
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CUSTOM_SETTINGS:
        return customSettings != null && !customSettings.isEmpty();
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SITE:
        return site != SITE_EDEFAULT;
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DEFAULT_VALUE:
        return DEFAULT_VALUE_EDEFAULT == null ? defaultValue != null : !DEFAULT_VALUE_EDEFAULT.equals(defaultValue);
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__TITLE:
        return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title);
      case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__DESCRIPTION:
        return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
  {
    if (baseClass == SelectParam.class)
    {
      switch (derivedFeatureID)
      {
        case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT: return WPPlugBenchPackage.SELECT_PARAM__SELECT;
        default: return -1;
      }
    }
    if (baseClass == ChoiceParam.class)
    {
      switch (derivedFeatureID)
      {
        case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE: return WPPlugBenchPackage.CHOICE_PARAM__CHOICE;
        default: return -1;
      }
    }
    if (baseClass == CustomParam.class)
    {
      switch (derivedFeatureID)
      {
        case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CLASS_NAME: return WPPlugBenchPackage.CUSTOM_PARAM__CLASS_NAME;
        case WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CUSTOM_SETTINGS: return WPPlugBenchPackage.CUSTOM_PARAM__CUSTOM_SETTINGS;
        default: return -1;
      }
    }
    return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
  {
    if (baseClass == SelectParam.class)
    {
      switch (baseFeatureID)
      {
        case WPPlugBenchPackage.SELECT_PARAM__SELECT: return WPPlugBenchPackage.DEFAULT_OPTION_PARAM__SELECT;
        default: return -1;
      }
    }
    if (baseClass == ChoiceParam.class)
    {
      switch (baseFeatureID)
      {
        case WPPlugBenchPackage.CHOICE_PARAM__CHOICE: return WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CHOICE;
        default: return -1;
      }
    }
    if (baseClass == CustomParam.class)
    {
      switch (baseFeatureID)
      {
        case WPPlugBenchPackage.CUSTOM_PARAM__CLASS_NAME: return WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CLASS_NAME;
        case WPPlugBenchPackage.CUSTOM_PARAM__CUSTOM_SETTINGS: return WPPlugBenchPackage.DEFAULT_OPTION_PARAM__CUSTOM_SETTINGS;
        default: return -1;
      }
    }
    return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (className: ");
    result.append(className);
    result.append(", site: ");
    result.append(site);
    result.append(", defaultValue: ");
    result.append(defaultValue);
    result.append(", title: ");
    result.append(title);
    result.append(", description: ");
    result.append(description);
    result.append(')');
    return result.toString();
  }

} //DefaultOptionParamImpl
